package com.ruyuan.payment.server.config;

import com.ruyuan.payment.server.interceptor.LoginMemberInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

   @Resource
   LoginMemberInterceptor loginMemberInterceptor;

   @Override
   public void addInterceptors(InterceptorRegistry registry) {
       registry.addInterceptor(loginMemberInterceptor)
               .addPathPatterns("/**")
               .excludePathPatterns(
                       "/member/login",
                       "/member/register",
                       "/admin/**",
                       "/test/**",
                       "/alipay"
               );
   }
}
